//package work.huangxin.share.aop;
//
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import work.huangxin.share.model.ArticleMessage;
//import work.huangxin.share.service.impl.ArticleOperationService;
//
///**
// * @author 季台星
// * @Date 2023 03 22 16 51
// * 切面实现增加浏览量，点赞数，评论数
// */
//@Component
//@Aspect
//public class MyAspect {
//
//    @Autowired
//    private ArticleOperationService articleOperationService;
//    @Pointcut(("execution(* work.huangxin.share.controller.talk.GlobalDataController.getNewArticleById())"))
//    public void viewPointCut(){}
//
//    @AfterReturning("viewPointCut()")
//    public void doAfter(JoinPoint joinPoint){
//        //获得改方法的所有参数
//        Object[] args = joinPoint.getArgs();
//        Integer articleId = (Integer) args[0];
//        ArticleMessage articleMessage = articleOperationService.getById(articleId);
//        articleMessage.setTotalView(articleMessage.getTotalView() + 1);
//        articleOperationService.update(articleMessage);
//    }
//
//}
